package excel;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.log4j.Logger;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;

import po.MyObject;

public class Write2Exl {

	private static final Logger LOG = Logger.getLogger("Write2Exl");
	private static String fileName = "2013年甘肃省医疗卫生机构基础大输液类药品集中采购中标结果";//"中检所标准品查询2";//"甘肃";//"报价公示-2012.12.17";//"第一轮报价解密-2012.12.16";//"产品审核公示-2012.12.15";//"限价公示-2012.12.15";//"生产企业公示-2012.12.15";//"经营企业公示-2012.12.15";
	private static String filePath = "I:/data/CHD/tender/" + fileName + "/";
	private static String outputFile = "I:/data/CHD/tender/output/" + fileName + ".xlsx";
	private static int startPage = 1;
	private static int rowNum = 27;
	private static String regex = "<tr >.*?<td style=\"text-align:center;\">(.*?)</td>.*?"
			+"<td style=\"text-align:center;\">(.*?)</td>.*?"
			+"<td style=\"text-align:center;\">(.*?)</td>.*?"
			+"<td style=\"text-align:center;\">(.*?)</td>.*?"
			+"<td style=\"text-align:center;\">(.*?)</td>.*?"
			+"<td style=\"text-align:center;\">(.*?)</td>.*?"
			+"<td style=\"text-align:center;\">(.*?)</td>.*?"
			+"<td style=\"text-align:center;\">(.*?)</td>.*?"
			+"<td style=\"text-align:center;\">(.*?)</td>.*?"
			+"<td style=\"text-align:center;\">(.*?)</td>.*?"
			+"<td style=\"text-align:center;\">(.*?)</td>.*?"
			+"<td style=\"text-align:center;\">(.*?)</td>.*?"
			+"<td style=\"text-align:center;\">(.*?)</td>.*?"
			+"<td style=\"text-align:center;\">(.*?)</td>.*?"
			+"<td style=\"text-align:center;\">(.*?)</td>.*?"
			+"<td style=\"text-align:center;\">(.*?)</td>.*?</tr>.*?";
//			"<tr class=\"\\w\">.*?"      
//					+"<td class=\"left\" >(.*?)</td>.*?"
//					+"<td class=\"left\" style=\"width:.*?;\" >(.*?)</td>.*?"
//					+"<td class=\"left\">(.*?)</td>.*?"     
//					+"<td  class=\"center\">(.*?)</td>.*?"
//					+"<td  class=\"center\" >(.*?)</td>.*?"
//					+"<td  style=\"width:.*?; text-align:center\">(.*?)</td>.*?"
//					+"<td  class=\"center\">.*?<a href=\"/duizhaopin/(.*?).html\" target=\"_blank\">查看</a>.*?</td>.*?"
//					+"</tr>";
			
//			"<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">.*?"
//			+"<tr>.*?<td width=\"21%\" >.*?<span>品种编号.*?</span>.*?</td>.*?"
//			+"<td width=\"79%\" >(.*?)</td>.*?</tr>.*?"
//			+"<tr>.*?"
//			+"<td width=\"21%\" class=\"r\">.*?<span>名称</span>.*?</td>.*?"
//			+"<td width=\"79%\" class=\"r\">(.*?)</td>.*?</tr>.*?"
//			+"<tr>.*?"
//			+"<td width=\"21%\" >.*?<span>来源分类.*?</span>.*?</td>.*?"
//			+"<td width=\"79%\" >(.*?)</td>.*?</tr>.*?"
//			+"<tr>.*?"
//			+"<td width=\"21%\" class=\"r\">.*?<span>用途</span>.*?</td>.*?"
//			+"<td width=\"79%\" class=\"r\">(.*?)</td>.*?</tr>.*?"
//			+"<tr>.*?"
//			+"<td width=\"21%\" >.*?<span>包装.*?</span>.*?</td>.*?"
//			+"<td width=\"79%\" >(.*?)</td>.*?</tr>.*?"
//			+"<tr>.*?<td width=\"21%\" class=\"r\">.*?<span>单价</span>.*?</td>.*?"
//			+"<td width=\"79%\" class=\"r\">(.*?)</td>.*?</tr>.*?"
//			+"<tr>.*?"
//			+"<td width=\"21%\" >.*?<span>英文名.*?</span>.*?</td>.*?"
//			+"<td width=\"79%\" >(.*?)</td>.*?</tr>.*?"
//			+"<tr>.*?"
//			+"<td width=\"21%\" class=\"r\">.*?<span>批号</span>.*?</td>.*?"
//			+"<td width=\"79%\" class=\"r\">(.*?)</td>.*?</tr>.*?"
//			+"<tr>.*?"
//			+"<td width=\"21%\" >.*?<span>CAS号.*?</span>.*?</td>.*?"
//			+"<td width=\"79%\" >(.*?)</td>.*?</tr>.*?"
//			+"<tr>.*?"
//			+"<td width=\"21%\" class=\"r\">.*?<span>备注</span>.*?</td>.*?"
//			+"<td width=\"79%\" class=\"r\">(.*?)</td>.*?</tr>.*?</table>";
//			"<TR>.*?<TD class=\"datagrid-td-rownumber datagrid-cell-rownumber\">.*?</TD>.*?<TD>(.*?)</TD>.*?<TD>(.*?)</TD>.*?<TD>(.*?)</TD>.*?<TD>(.*?)</TD>.*?<TD>(.*?)</TD>.*?<TD>(.*?)</TD>.*?<TD>(.*?)</TD>.*?<TD>(.*?)</TD>.*?<TD>(.*?)</TD>.*?<TD>.*?<a href='.*?' class='.*?' iconCls='.*?'>.*?</a></TD>.*?</TR>";
//			"<tr >.*?"
//+"<td style=\"text-align:center;\">(.*?)</td>.*?"
//+"<td >(.*?)</td>.*?"
//+"<td >(.*?)</td>.*?"
//+"<td >(.*?)</td>.*?"
//+"<td>(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td >(.*?)</td>.*?"
//+"<td >(.*?)</td>.*?"
//+"<td >(.*?)</td>.*?"
//+"<td style=\"text-align:center;\">(.*?)</td>.*?"
//+"<td style=\"text-align:center;\">(.*?)</td>.*?"
//+"<td >(.*?)</td>.*?"
//+"<td >(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:right;\">(.*?)</td>.*?"
//+"<td style=\"text-align:left;\">(.*?)</td>.*?</tr>";
//			"<tr>.*?<td>.*?<span title='(.*?)'>.*?</span>.*?</td>.*?<td>.*?<a class=\".*?\" target=_blank title='(.*?)' href=\".*?\">.*?</a>.*?</td>.*?<td>.*?<span title='(.*?)'>.*?</span>.*?</td>.*?<td>.*?<span title='(.*?)'>.*?</span>.*?</td>.*?<td>(.*?)</td>.*?<td>.*?<span title='(.*?)'>.*?</span>.*?</td>.*?<td>(.*?)</td>.*?<td>.*?<a class=\".*?\" target=\"_blank\" title='(.*?)' href='.*?'>.*?</a>.*?</td>.*?<td>(.*?)</td>.*?<td>.*?<span title='(.*?)'>.*?</span>.*?</td>.*?</tr>";//吉林
//			"<tr>.*?<td style=\"width:35px;\">(.*?)</td>.*?<td>(.*?)</td>.*?<td>.*?<span id=\"gridview_ct.*?_Labs\">(.*?)</span>.*?</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td style=\"width:60px;\">.*?<span id=\"gridview_ct.*?_Labs\">(.*?)</span>.*?</td>.*?<td align=\"right\">(.*?)</td>.*?<td style=\"width:35px;\">(.*?)</td>.*?<td align=\"right\">(.*?)</td>.*?<td style=\"width:66px;\">(.*?)</td>.*?<td style=\"width:33px;\">(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?</tr>";
//			"<tr>.*?<td style=\"width:35px;\">(.*?)</td>.*?<td>(.*?)</td>.*?<td>.*?<span id=\"gridview_ct.*?_Labs\">(.*?)</span>.*?</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td style=\"width:60px;\">.*?<span id=\"gridview_ct.*?_Labs\">(.*?)</span>.*?</td>.*?<td align=\"right\">(.*?)</td>.*?<td style=\"width:35px;\">(.*?)</td>.*?<td align=\"right\">(.*?)</td>.*?<td style=\"width:66px;\">(.*?)</td>.*?<td style=\"width:33px;\">(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?</tr>";
//			"<tr>.*?<td style=\"width:35px;\">(.*?)</td>.*?<td>(.*?)</td>.*?<td>.*?<span id=\"gridview_ct.*?_Labs\">(.*?)</span>.*?</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td style=\"width:60px;\">.*?<span id=\"gridview_ct.*?_Labs\">(.*?)</span>.*?</td>.*?<td align=\"right\">(.*?)</td>.*?<td style=\"width:35px;\">(.*?)</td>.*?<td style=\"width:66px;\">(.*?)</td>.*?<td style=\"width:33px;\">(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?</tr>";
//			"<tr>.*?<td style=\"width:35px;\">(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td style=\"width:80px;\">(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?</tr>";
//			"<tr>.*?<td style=\"width:35px;\">(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td style=\"width:80px;\">(.*?)</td>.*?<td>(.*?)</td>.*?</tr>";
//			"<tr>.*?<td style=\"width:35px;\">(.*?)</td>.*?<td>.*?<span id=\"gridview_ct.*?_Labs\">(.*?)</span>.*?</td>.*?<td style=\"width:52px;\">(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>.*?<span id=\"gridview_ct.*?_Labs\">(.*?)</span>.*?</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td style=\"width:35px;\">(.*?)</td>.*?<td style=\"width:66px;\">(.*?)</td>.*?<td style=\"width:30px;\">(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td style=\"width:20px;\">(.*?)</td>.*?<td style=\"width:20px;\">(.*?)</td>.*?<td>(.*?)</td>.*?<td>.*?<span id=\"gridview_ct.*?_LabsIsCanBid\">(.*?)</span>.*?</td>.*?</tr>";
	private static String titleRegex = "";
//			"<tr class=\"zbnrbt\">.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?</tr>";//吉林
//			"<tr>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?</tr>";
//			"<tr>.*?<th scope=\"col\">(.*?)</th><th scope=\"col\">(.*?)</th><th scope=\"col\">(.*?)</th><th scope=\"col\">(.*?)</th><th scope=\"col\">(.*?)</th><th scope=\"col\">(.*?)</th><th scope=\"col\">(.*?)</th><th scope=\"col\">(.*?)</th><th scope=\"col\">(.*?)</th><th scope=\"col\">(.*?)</th><th scope=\"col\">(.*?)</th><th scope=\"col\">(.*?)</th><th scope=\"col\">(.*?)</th><th scope=\"col\">(.*?)</th><th scope=\"col\">(.*?)</th><th scope=\"col\">(.*?)</th>.*?</tr>";
//			"<tr>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?</tr>";
//			"<tr>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?</tr>";
//			"<tr style=\"height:12px;\">.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?</tr>";
//			"<tr>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?<th scope=\"col\">(.*?)</th>.*?</tr>";
	
	static StringBuffer readHtm(String filePath){
		StringBuffer document = new StringBuffer();
		InputStreamReader fr = null;
		BufferedReader br = null;
		String line = null;
		try {
			fr = new InputStreamReader(new FileInputStream(filePath), "utf-8");
			br = new BufferedReader(fr);
			while ((line = br.readLine()) != null) {
				document.append(line);
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			try {
				if (br != null) {
					br.close();
				}
				if (fr != null) {
					fr.close();
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		LOG.info("NO."+filePath);
		return document;
	}
	
	static void writeExl(List<MyObject> list) {
		FileOutputStream fOut = null;
		try {
			Workbook workbook = new SXSSFWorkbook(2000);
			Sheet sheet = workbook.createSheet("sheet0");
			Row row = null;
			fOut = new FileOutputStream(outputFile);
				for (int i = 0; i < list.size(); i++) {
					row = sheet.createRow(i);
//					row.createCell(0).setCellStyle(new Color(0, 0, 0));
					row.createCell(0).setCellValue(list.get(i).getObj1().trim());
					row.createCell(1).setCellValue(list.get(i).getObj2().trim());
					row.createCell(2).setCellValue(list.get(i).getObj3().trim());
					row.createCell(3).setCellValue(list.get(i).getObj4().trim());
					row.createCell((short)4).setCellValue(list.get(i).getObj5().trim());
					row.createCell((short)5).setCellValue(list.get(i).getObj6().trim());
					row.createCell((short)6).setCellValue(list.get(i).getObj7().trim());
					row.createCell((short)7).setCellValue(list.get(i).getObj8().trim());
					row.createCell((short)8).setCellValue(list.get(i).getObj9().trim());
					row.createCell((short)9).setCellValue(list.get(i).getObj10().trim());
					row.createCell(10).setCellValue(list.get(i).getObj11().trim());
					row.createCell(11).setCellValue(list.get(i).getObj12().trim());
					row.createCell(12).setCellValue(list.get(i).getObj13().trim());
					row.createCell(13).setCellValue(list.get(i).getObj14().trim());
					row.createCell((short)14).setCellValue(list.get(i).getObj15().trim());
					row.createCell((short)15).setCellValue(list.get(i).getObj16().trim());
					LOG.info("第"+i+"行");
				}
			workbook.write(fOut);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (null != fOut) {
				try {
					fOut.close();
					LOG.info("success export excel");
				} catch (Exception e) {
					e.printStackTrace(System.err);
				}
			}
		}
	}
	
	static List<MyObject> titleList(List<MyObject> list,int firstPage, StringBuffer text) {
		
		if(firstPage == startPage) {
			Pattern pattern = Pattern.compile(titleRegex);
			Matcher matcher = pattern.matcher(text);
			MyObject o = new MyObject();
			while (matcher.find()) {
				o.setObj1(matcher.group(1).trim());
				o.setObj2(matcher.group(2).trim());
				o.setObj3(matcher.group(3).trim());
				o.setObj4(matcher.group(4).trim());
				o.setObj5(matcher.group(5).trim());
				o.setObj6(matcher.group(6).trim());
				o.setObj7(matcher.group(7).trim());
				o.setObj8(matcher.group(8).trim());
				o.setObj9(matcher.group(9).trim());
				o.setObj10(matcher.group(10).trim());
				o.setObj11(matcher.group(11).trim());
				o.setObj12(matcher.group(12).trim());
				o.setObj13(matcher.group(13).trim());
				o.setObj14(matcher.group(14).trim());
				o.setObj15(matcher.group(15).trim());
				o.setObj16(matcher.group(16).trim());
				o.setObj17(matcher.group(17).trim());
				o.setObj18(matcher.group(18).trim());
				o.setObj19(matcher.group(19).trim());
				o.setObj20(matcher.group(20).trim());
				o.setObj21(matcher.group(21).trim());
				o.setObj22(matcher.group(22).trim());
				o.setObj23(matcher.group(23).trim());
				o.setObj24(matcher.group(24).trim());
				o.setObj25(matcher.group(25).trim());
				o.setObj26(matcher.group(26).trim());
				o.setObj27(matcher.group(27).trim());
				o.setObj28(matcher.group(28).trim());
				o.setObj29(matcher.group(29).trim());
				o.setObj30(matcher.group(30).trim());
				o.setObj31(matcher.group(31).trim());
				o.setObj32(matcher.group(32).trim());
				o.setObj33(matcher.group(33).trim());
				o.setObj34(matcher.group(34).trim());
				o.setObj35(matcher.group(35).trim());
				o.setObj36(matcher.group(36).trim());
				o.setObj37(matcher.group(37).trim());
				o.setObj38(matcher.group(38).trim());
				o.setObj39(matcher.group(39).trim());
				o.setObj40(matcher.group(40).trim());
				list.add(o);
			}
			
		} else {
			LOG.info("This is not first page , please check it !");
		}
		
		return list;
	}
	
	static void excute() {
		try {
			List<MyObject> list = new ArrayList<MyObject>();
			StringBuffer content = null;
			MyObject o = null;
			for (int i = startPage; i <= rowNum; i++) {
				content = readHtm(filePath+i+".htm");
//				if(i == startPage) {
//					titleList(list, i, content);
//				}
				Pattern pattern = Pattern.compile(regex);
				Matcher matcher = pattern.matcher(content);
				while (matcher.find()) {
					o = new MyObject();
					o.setObj1(matcher.group(1).trim());
					o.setObj2(matcher.group(2).trim());
					o.setObj3(matcher.group(3).trim());
					o.setObj4(matcher.group(4).trim());
					o.setObj5(matcher.group(5).trim());
					o.setObj6(matcher.group(6).trim());
					o.setObj7(matcher.group(7).trim());
					o.setObj8(matcher.group(8).trim());
					o.setObj9(matcher.group(9).trim());
					o.setObj10(matcher.group(10).trim());
					o.setObj11(matcher.group(11).trim());
					o.setObj12(matcher.group(12).trim());
					o.setObj13(matcher.group(13).trim());
					o.setObj14(matcher.group(14).trim());
					o.setObj15(matcher.group(15).trim());
					o.setObj16(matcher.group(16).trim());
					list.add(o);
				}
			}
			writeExl(list);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public static void main(String[] args) {
		excute();
	}

}